package com.ruicar.afs.cloud.basic.proceeds.pay.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruicar.afs.cloud.basic.proceeds.pay.entity.BasicPaymentPool;
import com.ruicar.afs.cloud.basic.proceeds.pay.entity.BasicPaymentRecord;
import com.ruicar.afs.cloud.basic.proceeds.pay.entity.BasicPaymentWriteOff;
import com.ruicar.afs.cloud.basic.proceeds.pay.mapper.BasicPaymentWriteOffMapper;
import com.ruicar.afs.cloud.basic.proceeds.pay.service.BasicPaymentWriteOffService;
import org.springframework.stereotype.Service;

import java.util.Calendar;

/**
 * @author: Lee
 * @date 2020-05-30 04:35:07 
 * @description 
 */
@Service
public class BasicPaymentWriteOffServiceImpl extends ServiceImpl<BasicPaymentWriteOffMapper, BasicPaymentWriteOff> implements BasicPaymentWriteOffService {

    @Override
    public void addPaymentWriteOff(BasicPaymentRecord paymentRecord, BasicPaymentPool pool) {
        BasicPaymentWriteOff paymentWriteOff = new BasicPaymentWriteOff();
        paymentWriteOff.setPoolId(paymentRecord.getPoolId());
        paymentWriteOff.setRecordId(paymentRecord.getId());
        paymentWriteOff.setContractNo(pool.getContractNo());
        paymentWriteOff.setPaymentBankCode(pool.getPaymentBankCode());
        paymentWriteOff.setPaymentAccount(pool.getPaymentAccount());
        paymentWriteOff.setPaymentAmt(pool.getPaymentAmt());
        paymentWriteOff.setReceiptBankCode(pool.getReceiptBankCode());
        paymentWriteOff.setReceiptBankName(pool.getReceiptBankName());
        paymentWriteOff.setReceiptEbankCode(pool.getReceiptEbankCode());
        paymentWriteOff.setReceiptAccount(pool.getReceiptAccount());
        paymentWriteOff.setReceiptAccountName(pool.getReceiptAccountName());
        paymentWriteOff.setSuccessTime(Calendar.getInstance().getTime());
        this.save(paymentWriteOff);
    }
}
